﻿using System;
using System.IO;
using System.Windows.Forms;
using finProj.Entities;

namespace finProj
{
    public partial class LoadDataset : Form
    {
        public LoadDataset()
        {
            InitializeComponent();

        }

        private void browse_btn_Click(object sender, EventArgs e)
        {
            string[] filenames;
            string path;

            var openFiledlg = new OpenFileDialog();
            openFiledlg.Multiselect = true;
            DialogResult res = openFiledlg.ShowDialog();

            if (res == DialogResult.OK)
            {
                filenames = openFiledlg.FileNames;
                path = Path.GetDirectoryName(filenames[0]);
                pathtextBox.Text = path;

                loadDataset(filenames);
               
            }




        }

        private void loadDataset(string[] filenames)
        {
            var mngr = new PictureManager();

            foreach (var filename in filenames)
            {
                var pic = new Picture(filename);
                pic.detectFaceFeatures();
                mngr.AddPicture(pic);
                Settings.Instance.picManager = mngr;

            }
        }

    }
}
